package com.rcnie.common;

import lombok.Data;

@Data
public class R<T> {
    private Integer code;//编码信息，1,0
    private String msg;//错误信息
    private T data;//数据

    public static <T> R<T> error(String msg){//失败
        R r = new R();
        r.setCode(0);
        r.setMsg(msg);
        return r;
    }

    public static <T> R<T> succes(T object){//成功
        R r = new R();
        r.setCode(1);
        r.setData(object);
        return r;
    }
}
